<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script type='text/javascript' src='js/vue.js'></script>
</head>
<body>
    <div id='app'>
        {{msg}}
        <input type="text" v-model="num1">
        <input type="text" v-model="num2">
        <p>{{getSum}}</p>
    </div>
    <script type='text/javascript'>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: 'Hello Vue',
                num1: '',
                num2: '',
                result: 0
            },
            //定义计算属性
            computed: {
                getSum() {
                    return this.result = Number(this.num1) + Number(this.num2)
                }
            }
        });
    </script>
</body>
</html>